<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <input type="text" placeholder="显示是否中奖" id="ipt">
    <button id="btn">抽奖</button>
    <div id="word"></div>
    <script>
        let btn = document.getElementById('btn')
        let word = document.getElementById('word')
        let ipt = document.getElementById('ipt')
        let arr = []
        function zb(arr) {
            arr = arr.length ? [] : arr
            for (let i = 0; i < 10; i++) {
                arr.push(false)
            }
            arr[Math.floor(10 * Math.random())] = true
        }
        zb(arr)
        let i = 0
        btn.addEventListener('click', function () {
            console.log(arr, arr[i]);
            if (arr[i] == true) {
                ipt.value = '中奖'
                word.innerText = `第${i + 1}次抽奖，中奖，重新布置奖池`
                i = 0
                arr = []
                zb(arr)
                return
            } else {
                ipt.value = '未中奖'
                word.innerText = `第${i + 1}次抽奖，未中奖`
                i++
            }

        })

    </script>
</body>

</html>